package edu.nf.relaxenjoy.web.controller.app;

import edu.nf.relaxenjoy.common.result.ResultVO;
import edu.nf.relaxenjoy.service.RecommendService;
import edu.nf.relaxenjoy.web.controller.BaseController;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

@RestController
@RequiredArgsConstructor
@RequestMapping("/api/recommend/newRecommend")
@Api(tags="使用机器学习模型重做推荐系统")
public class RecommendController extends BaseController {

    private final RecommendService recommendService;

    /**
     * 暂时随机推荐
     * @param page
     * @param limit
     * @param uid
     * @return
     */
    @RequestMapping("RecommendToUserByCF/{page}/{limit}")
    public ResultVO RecommendToUserByCF(@PathVariable long page, @PathVariable long limit, String uid){
        HashMap<String, Object> map = recommendService.recommendToUserByCF(page, limit, uid);
        return success(map);
    }

    /**
     * 推荐功能
     * @param page
     * @param limit
     * @param uid
     * @return
     */
    @RequestMapping("newRecommendToUser/{page}/{limit}")
    public ResultVO newRecommendToUser(@PathVariable long page, @PathVariable long limit, String uid){
        HashMap<String, Object> map = recommendService.recommendToUser(page, limit, uid);
        return success(map);
    }
}
